Auto merge of #2534 - alexcrichton:lock-with-git-repos, r=brson
authorbors <bors@rust-lang.org>
Sat, 2 Apr 2016 23:26:03 +0000 (16:26 -0700)
committerbors <bors@rust-lang.org>
Sat, 2 Apr 2016 23:26:03 +0000 (16:26 -0700)
Replace existing sources before updating

Currently sources may acquire file locks to ensure that they're not tampered
with while they're in use. We may load two sources to the same location,
however, in the case of git repositories which need to be updated. Cargo will
first load a locked version of the source and then may load an unlocked version,
and these two loads currently deadlock.

This commit tweaks the logic when updating a source to only update it after the
previous source has been replaced.

Closes #2533


Trivial merge